#ifndef DETECT_THREAD
#define DETECT_THREAD

#include <QString>
#include <QThread>
#include <main_window_c.h>
class DetectThreadBase : public QThread {

protected:
	MainWindow* main_window;

public:
	static bool STOP;
	static int ID;
	static QThread* cur_thread;
	static void stop();


	DetectThreadBase(MainWindow& mw);
	virtual void do_detect() = 0;
	virtual int get_detect_id() = 0;
	virtual void run();
	virtual void before_running();
	virtual void after_running();
	virtual void clear();

};

class ImageDetectThread : public DetectThreadBase {
private:
	QString file;
public:
	const static int ID;
	ImageDetectThread(MainWindow& mw, const QString& file);
	void do_detect();
	int get_detect_id();
};

class VideoDetectThread : public DetectThreadBase {
private:
	const QString file;

public:
	const static int ID;
	VideoDetectThread(MainWindow& mw, const QString& file);
	void do_detect();
	int get_detect_id();
};

class CameraDetectThread : public DetectThreadBase {

public:
	const static int ID;
	using DetectThreadBase::DetectThreadBase;
	void do_detect();
	int get_detect_id();
};


class WarmUpThread : public QThread {
private:
	float iou_thres;
	float conf_thres;
	QString path;
	MainWindow* main_window;
	cv::Size input_shape;

public:
	WarmUpThread(MainWindow& mw, const QString& path, float iou_thres, float conf_thres, const cv::Size& input_shape);
	virtual void run();
};

#endif // DETECT_THREAD
